<?php
/**
 * Created by PhpStorm.
 * User: yangfan
 * Date: 2020/1/15
 * Time: 2:30 PM
 */

namespace App\Entities;

class GoodsPaymentEntity extends ABaseEntity
{
    public function __construct(GoodsPaymentModel $goodsPayment)
    {
        $this->model = $goodsPayment;
    }

    /**
     * @param string $tradeNo
     * @return GoodsPaymentEntity
     */
    public static function findByTradeNo(string $tradeNo)
    {
        $model = GoodsPaymentModel::where('trade_no', $tradeNo)->first();
        if (is_null($model)) {
            return null;
        }
        return new self($model);
    }

    public function getId()
    {
        return $this->model->id;
    }

    /**
     * @return string
     */
    public function getGoodsName()
    {
        return $this->model->goods_name;
    }

    /**
     * @param string $value
     */
    public function setGoodsName(string $value)
    {
        $this->model->goods_name = $value;
    }

    /**
     * @return int
     */
    public function getOrderId()
    {
        return $this->model->order_id;
    }

    /**
     * @param int $value
     */
    public function setOrderId(int $value)
    {
        $this->model->order_id = $value;
    }

    /**
     * 交易号
     * @return string
     */
    public function getTradeNo(): string
    {
        return $this->model->trade_no;
    }

    /**
     * 交易号
     * @param string $value
     */
    public function setTradeNo(string $value)
    {
        $this->model->trade_no = $value;
    }

    /**
     * @return int
     */
    public function getIsMaster()
    {
        return $this->model->is_master;
    }

    /**
     * @param int $value
     */
    public function setIsMaster(int $value)
    {
        $this->model->is_master = $value;
    }

    /**
     * @return int
     */
    public function getNum()
    {
        return $this->model->num;
    }

    /**
     * @param int $value
     * @return int
     */
    public function setNum(int $value)
    {
        return $this->model->num = $value;
    }

    /**
     * @return int
     */
    public function getProductSkuPrice()
    {
        return $this->model->product_sku_price;
    }

    /**
     * @param int $value
     */
    public function setProductSkuPrice(int $value)
    {
        $this->model->product_sku_price = $value;
    }

    /**
     * @return int
     */
    public function getProductSkuId()
    {
        return $this->model->product_sku_id;
    }

    /**
     * @param int $value
     */
    public function setProductSkuId(int $value)
    {
        $this->model->product_sku_id = $value;
    }

    /**
     * @return int
     */
    public function getCouponDiscountValue()
    {
        return $this->model->coupon_discount_value;
    }

    /**
     * @param int $value
     */
    public function setCouponDiscountValue(int $value)
    {
        $this->model->coupon_discount_value = $value;
    }

    /**
     * @return int
     */
    public function getCouponCodeId()
    {
        return $this->model->coupon_code_id;
    }

    /**
     * @param int $value
     */
    public function setCouponCodeId(int $value)
    {
        $this->model->coupon_code_id = $value;
    }

    /**
     * @return int
     */
    public function getAmount()
    {
        return $this->model->amount;
    }

    /**
     * 总金额，以分为单位
     * @param int $value
     */
    public function setAmount(int $value)
    {
        $this->model->amount = $value;
    }

    /**
     * @return int
     */
    public function getTransactionRecordId()
    {
        return $this->model->transaction_record_id;
    }

    /**
     * @param int $id
     * @return void
     */
    public function setTransactionRecordId(int $id)
    {
        $this->model->transaction_record_id = $id;
    }

    /**
     * @param int $value
     */
    public function setUseBalance(int $value)
    {
        $this->model->use_balance = $value;
    }

    /**
     * @return  int
     */
    public function getUseBalance()
    {
        return $this->model->use_balance;
    }

    /**
     * @return int
     */
    public function getIsPaid(): int
    {
        return $this->model->is_paid;
    }

    /**
     * @param int $value
     */
    public function setIsPaid(int $value)
    {
        $this->model->is_paid = $value;
    }

    /**
     * 用户ID
     * @return int
     */
    public function getUserId()
    {
        return $this->model->user_id;
    }

    /**
     * 用户ID
     * @param int $userId
     */
    public function setUserId(int $userId)
    {
        $this->model->user_id = $userId;
    }

    /**
     * @return string
     */
    public function getCreatedAt()
    {
        return $this->model->created_at;
    }

    /**
     * 权益卡抵扣金额
     * @param int $convertible_card_discount_value
     */
    public function setConvertibleCardDiscountValue(int $convertible_card_discount_value): void
    {
        $this->model->convertible_card_discount_value = $convertible_card_discount_value;
    }

    /**
     * @return int
     */
    public function getConvertibleCardDiscountValue(): int
    {
        return $this->model->convertible_card_discount_value;
    }
}
